#![allow(non_camel_case_types)]
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(type_alias_bounds)]

use crate::*;

// import lang from './@arkts.lang';
use crate::arkts::lang::default as lang;

pub mod utils {
	use super::*;
	pub mod locks {
		use super::*;
		// type AsyncLockCallback<T> = () => T | Promise<T>;
		pub type AsyncLockCallback<'val> = dyn Fn() -> Value<'val>;

		// class AsyncLock {
		pub struct AsyncLock<'val>(pub Value<'val>);
		IMPL_NAPI!(AsyncLock, Value);

		pub enum AsyncLockMode {
			SHARED = 1,
			EXCLUSIVE = 2,
		}

		// class AsyncLockOptions<T> {
		pub struct AsyncLockOptions<'val, T>(pub Value<'val>, core::marker::PhantomData<T>);
		IMPL_NAPI!(AsyncLockOptions<T>, Value);

		// class AsyncLockState {
		pub struct AsyncLockState<'val>(pub Value<'val>);
		IMPL_NAPI!(AsyncLockState, Value);

		// class AsyncLockInfo {
		pub struct AsyncLockInfo<'val>(pub Value<'val>);
		IMPL_NAPI!(AsyncLockInfo, Value);

		// class AbortSignal<T> {
		pub struct AbortSignal<'val, T>(pub Value<'val>, core::marker::PhantomData<T>);
		IMPL_NAPI!(AbortSignal<T>, Value);

		// class ConditionVariable {
		pub struct ConditionVariable<'val>(pub Value<'val>);
		IMPL_NAPI!(ConditionVariable, Value);
	}
	pub mod ASON {
		use super::*;

		// type ISendable = lang.ISendable;
		use lang::ISendable;

		// type Transformer = (this: ISendable, key: string, value: ISendable | undefined | null) => ISendable | undefined | null;
		pub type Transformer<'val, T0: ISendable<'val>, T1: ISendable<'val>, R: ISendable<'val>> = dyn Fn(T0, String, Option<T1>) -> Option<R>;

		// function parse(text: string, reviver?: Transformer, options?: ParseOptions): ISendable | null;

		// function stringify(value: Object | null | undefined): string;

		enum BigIntMode {
			DEFAULT = 0,
			PARSE_AS_BIGINT = 1,
			ALWAYS_PARSE_AS_BIGINT = 2,
		}

		enum ParseReturnType {
			OBJECT = 0,
			MAP = 1,
		}

		// interface ParseOptions {
		pub trait ParseOptions<'val>: InterFace<'val> {}
	}

	// class SendableLruCache<K, V> {
	pub struct SendableLruCache<'val, K, V>(pub Value<'val>, core::marker::PhantomData<K>, core::marker::PhantomData<V>);
	IMPL_NAPI!(SendableLruCache<K, V>, Value);

	// function isSendable(value: Object | null | undefined): boolean;
}
pub use utils as default;
